package com.weishuang.monitor.leader.controller;


import com.weishuang.monitor.leader.commons.entity.Result;
import com.weishuang.monitor.leader.commons.utils.ResultUtils;
import com.weishuang.monitor.leader.entity.vo.ServerDiskInfoVo;
import com.weishuang.monitor.leader.entity.vo.ServerDiskUseVo;
import com.weishuang.monitor.leader.service.IServerDiskInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 服务器磁盘信息 前端控制器
 * </p>
 *
 * @author weishuang
 * @since 2021-03-23
 */
@RestController
@RequestMapping("/leader/serverDiskinfo")
public class ServerDiskInfoController {

    @Autowired
    private IServerDiskInfoService serverDiskInfoService;

    /**
     * 获取硬盘使用信息情况
     *
     * @param sysId
     * @return
     */
    @GetMapping("getDiskUseInfo/{sysId}")
    public Result getDiskUseInfo(@PathVariable String sysId) {
        ServerDiskUseVo serverDiskUserVo = serverDiskInfoService.getDiskUseInfo(sysId);
        return ResultUtils.success(serverDiskUserVo);
    }

    /**
     * 获取服务器磁盘信息列表
     * @param sysId
     * @return
     */
    @GetMapping("listDiskInfos/{sysId}")
    public Result listDiskInfos(@PathVariable String sysId) {
        List<ServerDiskInfoVo> list = serverDiskInfoService.serverDiskInfoService(sysId);
        return ResultUtils.success(list);
    }

}
